#+AUTHOR:Joshua Branson
#+TITLE: Grub
#+LATEX_HEADER: \usepackage{lmodern}
#+LATEX_HEADER: \usepackage[QX]{fontenc}
#+OPTIONS: H:10 toc:nil

* Grub
** Booting an OS From Grub
*** multiboot

 boot to an installed GNU/Linux distro on your machine

#+BEGIN_EXAMPLE
set root=(hd0,PartionNumberWhere/BootIs)
linux /boot/vmlinuz-linux-libre root=/dev/sdaPartionNumberWhereRootIs
initrd /boot/initramfs-linux-libre.img
boot
#+END_EXAMPLE

For me this looks like:

#+BEGIN_EXAMPLE
set root=(hd0,1)
linux /boot/vmlinuz-linux-libre root=/dev/sda1
initrd /boot/initramfs-linux-libre.img
boot
#+END_EXAMPLE
*** chainloading

As soon as you see the grub command line press the "c" key. You'll be dropped into a grub shell.  You'll know you're there, because you'll see

#+BEGIN_EXAMPLE
grub >
#+END_EXAMPLE

Now, this is what you type

=set root=(=

Now press TAB and grub will give you some options.  Grub will expand what you wrote into

#+BEGIN_EXAMPLE
set root=(hd
#+END_EXAMPLE

Grub will then tell you to either press 1 or 0.  hd0 is your hard drive.  You don't want that.  So type

#+BEGIN_EXAMPLE
set root=(hd1)
#+END_EXAMPLE

Now type

#+BEGIN_EXAMPLE
chainloader +1
#+END_EXAMPLE

That will essentially tell the grub that is on your harddisk, to chainload to the usb.  This means that the usb stick has grub (or some other similiar software on it).  So grub won't try to find a bootable kernel on the usb stick.  Instead, your harddrive's grub will hand over controll to the usb stick's grub.

#+BEGIN_EXAMPLE
boot
#+END_EXAMPLE
*** booting from guixSD


configfile (hd0,gpt1)/boot/grub/grub.cfg
** Changing Grub's keyboard layout

First, check that you're using GRUB v2 or above.

grub-install --version

Generate a GRUB keyboard layout file. Below is the command for a french keyboard. For other languages, check /usr/share/X11/xkb/symbols/. Filename choice is not important (you can change bepo).

sudo grub-kbdcomp -o /boot/grub/bepo.gkb fr

Edit /etc/default/grub with root rights to have:

#GRUB_HIDDEN_TIMEOUT=0
GRUB_TERMINAL_INPUT="at_keyboard"

Edit /etc/grub.d/40_custom with root rights to have:

#!/bin/sh
exec tail -n +3 $0

insmod keylayouts
keymap /boot/grub/bepo.gkb

Finally:

sudo update-grub

Note: Forget immediately about using the Shift key to display GRUB menu! It may be normal that terminal_input at_keyboard make this key not work anymore. So make sure #GRUB_HIDDEN_TIMEOUT=0 is properly commented.

http://askubuntu.com/questions/751259/how-to-change-grub-command-line-grub-shell-keyboard-layout
